package com.pro.controller;

import com.pro.entry.JsMicrocircle;
import com.pro.service.JsMicrocircleService;
import com.pro.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.logging.Logger;

/**
 * ClassName:JsMicrocircleController
 * Package:com.pro.controller
 * Description:
 *
 * @Date:2022/4/8 11:24
 * @Author: ZPT
 */
@RestController
@RequestMapping("/microcircle")
public class JsMicrocircleController {
    @Autowired
    private JsMicrocircleService microcircleService;

    /**
     * @author ZPT
     * @content :查询微圈信息
     */
    @RequestMapping("/getMicrocircle")
    public JsonData getMicrocircle(Integer acticleCategroyId) {
        List<JsMicrocircle> microcircleList = microcircleService.getMicrocircle(acticleCategroyId);
        return microcircleList != null ? JsonData.buildSuccess(microcircleList) : JsonData.buildError("服务端错误");
    }

    /**
     * @author ZPT
     * @content :根据id查询微圈信息
     */
    @RequestMapping("/getMicrocircleById")
    public JsonData getMicrocircleById(Integer microcircleId) {
        JsMicrocircle microcircle = microcircleService.getMicrocircleById(microcircleId);
        return microcircle != null ? JsonData.buildSuccess(microcircle) : JsonData.buildError("服务端错误");
    }
}
